/**      
 * @file		arrayPtr.cpp
 * @description		Demostrates an arrayPtr and an array variable can be used
 *			similarly. Remember an array variable is a pointer to the
 *			address of the member location of the first element in the 
 *			array.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

// Integer Pointer
typedef int* IntPtr;

const int SIZE = 10;

/**
* @return zero if the application executes successfully
*/
int main() {
	// remember arrays are basically pointers that point to 
	// the first element in the array
	int array[SIZE];

	// Here we define an integer pointer
	IntPtr arrayPtr;

	cout << "Initializing array to values.\n\n";
	for(int i = 0; i < SIZE; i++) {
		array[i] = i;
	}

	// set the pointer to point to the first element in the array
	arrayPtr = array;

	for(int i = 0; i < SIZE; i++) {
		cout << "arrayPtr[" << i << "] " << arrayPtr[i] << endl;
	}
	cout << endl;

	cout << "Modifying the array by using the arrayPtr.\n\n";
	for(int i = 0; i < SIZE; i++) {
		arrayPtr[i] = arrayPtr[i] + 1;
	}

	for(int i = 0; i < SIZE; i++) {
		cout << "array[" << i << "] " << array[i] << endl;
	}

	return 0;
}
